<template>
  <div id="app">
    <!-- 路由占位符 -->
    <router-view></router-view>
  </div>
</template>

<script>
import router from '@/router/index'
import { initDynamicRoutes } from '@/utils/utils'

export default {123
  name: "app",
  data() {
    return {};
  },
  created() {

        // 获取设备的宽度
    var getPxSize = () => {
        let currentWidth = document.documentElement.clientWidth;
        // console.log(currentWidth);
        let pxSize = ( 16 * ( currentWidth/1920 ) > 32? 32 + "px" : ( 16 * ( currentWidth/1920 ) + "px") );
        document.documentElement.style.fontSize = pxSize;
    }
    window.addEventListener( "load", getPxSize )
    window.addEventListener( "resize", getPxSize )

    this.removeloadingdiv();

    const data = JSON.parse( window.sessionStorage.getItem('RouteData') )

    if ( data ) {
      const routeArr = initDynamicRoutes(data, [])
      router.addRoutes(routeArr)
    }
  },
  methods: {
    removeloadingdiv() {
        setTimeout(() => {
          let loading = document.getElementById("loading");
          if (loading !== null) {
            document.body.removeChild(loading);
          }
        },5)
    },
  },
};
</script>
<style>
#app {
  height: 100vh;
}
</style>
